<template>
  <view class="container">
    <!-- 顶部渐变背景 + 标题 -->
    <view class="top-section">
      <image 
        src="https://resource.tuniaokj.com/images/index_bg/template_new.jpg" 
        mode="widthFix" 
        class="top-bg"
      ></image>
      <view class="title-box">
        <text class="main-title">场/地/选/择</text>
      </view>
    </view>


    <!-- 羽毛球场网格列表 -->
    <view class="court-container">
      <view class="court-grid">
        <view 
          v-for="num in 31" 
          :key="num" 
          class="court-item" 
          @click="selectCourt(num)"
        >
          {{ num }}号羽毛球场
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {}
  },
  methods: {
    // 选择羽毛球场
    selectCourt(num) {
      uni.showToast({
        title: `选择${num}号羽毛球场`,
        icon: 'none'
      })
      // 实际项目中添加页面跳转逻辑
    }
  }
}
</script>

<style scoped>
/* 页面容器 */
.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f5f8ff;
}

/* 顶部区域 */
.top-section {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
}
.top-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}
.title-box {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
}
.main-title {
  font-size: 22px;
  font-weight: bold;
  color: #ff5722;
  text-shadow: 0 2px 4px rgba(255,255,255,0.8);
}

/* 羽毛球场标题 */
.sub-title {
  padding: 12px 16px 8px;
}
.sub-title-text {
  font-size: 17px;
  font-weight: bold;
  color: #333;
}

/* 羽毛球场网格容器 */
.court-container {
  padding: 0 16px 16px;
}
.court-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 羽毛球场项目 - 高度调整为原来的60%，两个一排 */
.court-item {
  flex: 1 1 calc(50% - 5px); /* 两个一排，减去间距 */
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 8px; /* 减小内边距 */
  height: 48px; /* 高度调整为原来的60%（原12px + 40px → 现8px + 32px） */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  transition: all 0.3s;
}
.court-item:active {
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
</style>